<?php
$this->title = "发布链接";
?>
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\models\Category;
use kartik\widgets\Select2;
use common\WuMing;
use yii\widgets\Pjax;

/* @var $this yii\web\View */
/* @var $model frontend\models\Post */
/* @var $form yii\widgets\ActiveForm */
?>
<?php Pjax::begin()?>
<div class="main  pd20 mb20  post-create">
    <div role="tabpanel">

        <!-- Nav tabs -->
        <ul class="nav nav-tabs" role="tablist">
            <li role="presentation"><a href="<?= Yii::$app->urlManager->createUrl("post/article") ?>">帖子</a></li>
            <li role="presentation"><a href="<?= Yii::$app->urlManager->createUrl("post/pic") ?>">图片</a></li>
            <li role="presentation" class="active"><a href="<?= Yii::$app->urlManager->createUrl("post/url") ?>">链接</a>
            </li>
        </ul>

        <!-- Tab panes -->
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="home">
                <div class="post-form">

                    <?php $form = ActiveForm::begin(); ?>
                    <div class="row">
                        <div class="col-xs-10">
                            <?= $form->field($model, 'url')->textInput(['maxlength' => 255, 'placeholder' => '请输入链接地址'])->label("") ?>

                        </div>
                        <div class="col-xs-2">
                            <div class="form-group field-urlform-url required">
                                <button class="btn btn-primary get-title" style="margin-top: 20px;">获取标题</button>
                            </div>

                        </div>
                    </div>


                    <?= $form->field($model, 'title')->textInput(['maxlength' => 100, 'placeholder' => '请输入链接标题'])->label("") ?>


                    <?= $form->field($model, 'content')->textarea(['rows' => 6])->label("简要描述(选填)") ?>
                    <div class="form-group">
                        <label for="">揭示板(必选)</label>
                        <div class="tagslist">
                            <?php $cates = WuMing::getUserCategory(Yii::$app->user->id, false) ?>
                            <?php foreach($cates as $v):?>
                                <span class="list-tag" data-id="<?=$v['id']?>"><?=$v['name']?></span>
                            <?php endforeach;?>
                        </div>
                    </div>
                    <?= $form->field($model, 'cid3')->hiddenInput(['class'=>'cate-cid'])->label(false) ?>

                    <div class="clearfix"></div>
                    <div class="form-group">
                        <?= Html::submitButton('发布链接', ['class' => 'btn  btn-primary']) ?>
                    </div>

                    <?php ActiveForm::end(); ?>

                </div>

            </div>

        </div>

    </div>
</div>
<?php Pjax::end()?>